package com.paradisecloudtech.vc.system.ui.fragment;

import android.os.Bundle;
import android.view.LayoutInflater;
import android.view.View;
import android.view.ViewGroup;
import android.widget.RelativeLayout;
import android.widget.TextView;

import com.common.library.base.BaseFragment;
import com.paradisecloudtech.vc.system.R;
import com.paradisecloudtech.vc.system.entity.EventBusEvent;

import org.greenrobot.eventbus.EventBus;

import butterknife.BindView;
import butterknife.ButterKnife;
import butterknife.OnClick;
import butterknife.Unbinder;

public class SlideFragment extends BaseFragment {

    @BindView(R.id.rl_slide_item_1)
    public RelativeLayout rlSlideItem1;
    @BindView(R.id.rl_slide_item_2)
    public RelativeLayout rlSlideItem2;
    @BindView(R.id.tv_slide_item_1_tip)
    TextView tvSlideItem1Tip;
    @BindView(R.id.tv_slide_item_2_tip)
    TextView tvSlideItem2Tip;
    @BindView(R.id.tv_slide_item_3_tip)
    TextView tvSlideItem3Tip;
    @BindView(R.id.tv_slide_content_title)
    TextView tvSlideContentTitle;

    public static SlideFragment slideFragment;

    public SlideFragment() {

    }

    public static SlideFragment getInstance() {
        if (slideFragment == null) {
            slideFragment = new SlideFragment();
        }
        return slideFragment;
    }

    @Override
    public int getLayoutId() {
        return R.layout.fragment_slide;
    }

    @Override
    protected void initVar() {

    }

    @Override
    public void initData() {
        tvSlideContentTitle.setText(R.string.conf_manager);
    }

    @Override
    public void initListener() {

    }

    @OnClick({R.id.rl_slide_item_1, R.id.rl_slide_item_2})
    public void onClickView(View view) {
        switch (view.getId()) {
            case R.id.rl_slide_item_1:
                String tip1 = tvSlideItem1Tip.getText().toString().trim();
                tvSlideContentTitle.setText(tip1);
                EventBus.getDefault().post(new EventBusEvent.SlideItemClickEvent(view.getId(), tip1));
                break;

            case R.id.rl_slide_item_2:
                String tip2 = tvSlideItem2Tip.getText().toString().trim();
                tvSlideContentTitle.setText(tip2);
                EventBus.getDefault().post(new EventBusEvent.SlideItemClickEvent(view.getId(), tip2));
                break;
        }
    }

}
